from appium import webdriver
from basePage.baseAPP import BaseAPP
from selenium.webdriver.common.by import By
from page.mailListManage import *

class MailListManagePage(BaseAPP):

    def __init__(self, driver):
        super().__init__(driver)

    def in_to_mail_list(self):
        self.my_start_app("com.tencent.wework", ".launch.WwMainActivity")
        self.my_click(MailListManageElement.mail_list_page_button)

    def create_org(self, org_name, parent_org=None):
        self.my_click(MailListManageElement.mail_list_manage_button)
        if parent_org:
            for i in parent_org:
                self.my_click((MailListManageElement.org_one_of_list[0], MailListManageElement.org_one_of_list[1].format(i)))
        self.my_click(MailListManageElement.create_child_org_button)
        self.my_send(MailListManageElement.org_name_input, org_name)
        self.my_click(MailListManageElement.confirm_button)